Skip to content

docs(data_classes): correct AppSync identity docstring for OPENID_CONNECT and pin the dispatch - #8705

Merged
leandrodamascena merged 2 commits into
aws-powertools:developfrom
ShussMiao:docs/appsync-identity-openid-connect-dispatch
Nov 4, 2026
Merged

leandrodamascena merged 2 commits into
aws-powertools:developfrom
ShussMiao:docs/appsync-identity-openid-connect-dispatch

Conversation

@ShussMiao

Copy link
Copy Markdown
Contributor

Issue number: closes #8704

Summary

Changes

AppSyncEventBase.identity documented OPENID_CONNECT as returning None. It cannot: get_identity_object returns None only when the identity mapping itself is None, and an OIDC identity always carries sub, so it resolves to AppSyncIdentityCognito — the class that already exposes the OIDC fields (claims, issuer, groups, default_auth_strategy).

The existing suite already relied on this: test_appsync_resolver_event.py:48 asserts isinstance(parsed_event.identity, AppSyncIdentityCognito) for appSyncResolverEvent.json, whose identity is OIDC-shaped. The docstring was the outlier, and carried a NEED TO TEST note.

  • Corrects the OPENID_CONNECT line and removes its NEED TO TEST note.
  • Fixes the typo in the line above (type of identify found → type of identity found).
  • Adds two tests that pin the dispatch: OIDC identity → AppSyncIdentityCognito with its fields reachable, and "only a None identity maps to None".
  • Leaves AWS_LAMBDA explicitly marked unverified rather than guessing, since its mapping is whatever the authorizer returns and there is no fixture for it.

User experience

No behavioural change — the docstring now matches what already happens, so anyone reading identity to decide which class to expect for an OIDC-authorized API no longer gets told it will be None.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

…ty dispatch

`AppSyncEventBase.identity` documented OPENID_CONNECT as returning None, but
`get_identity_object` only returns None when the identity mapping itself is
None, so an OIDC identity (which always carries `sub`) resolves to
`AppSyncIdentityCognito` — which already models the OIDC fields. The existing
test suite already asserted that; the docstring was the outlier.

Corrects the line, drops the two `NEED TO TEST` notes for the case that is now
settled, and adds tests pinning the dispatch so docstring and behaviour cannot
drift apart again. `AWS_LAMBDA` is left as explicitly unverified rather than
guessed at, since its mapping is whatever the authorizer returns.

Signed-off-by: ShussMiao <168898188+ShussMiao@users.noreply.github.com>
@ShussMiao
ShussMiao requested a review from a team as a code owner October 30, 2026 02:45
@boring-cyborg boring-cyborg Bot added the tests label Oct 30, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 30, 2026
@leandrodamascena leandrodamascena added the documentation Improvements or additions to documentation label Oct 31, 2026
@leandrodamascena leandrodamascena added this to the 3.40.0 milestone Oct 31, 2026

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ShussMiao, that's exactly what I asked for in the issue, and the two tests pin the dispatch so the docstring can't drift again. The AWS_LAMBDA case you left open is real: that identity lands on AppSyncIdentityIAM today and shouldn't. I opened #8718 for it.

I'm approving now. This goes out in 3.40.0, so it will sit here for a while before I merge it. No rebase needed in the meantime, and you'll be credited in the release notes.

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.00%. Comparing base (3b26155) to head (22eafc5).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8705   +/-   ##
========================================
  Coverage    97.00%   97.00%           
========================================
  Files          321      321           
  Lines        16415    16415           
  Branches      1482     1482           
========================================
  Hits         15924    15924           
  Misses         350      350           
  Partials       141      141           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@leandrodamascena
leandrodamascena merged commit 80e3632 into aws-powertools:develop Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: AppSync identity docstring says OPENID_CONNECT returns None, but the dispatch has no such path

2 participants